Actor "MorningStar" : ClericWeapon //replaces CWeaponPiece3
{
	Inventory.PickupMessage "MORNING STAR"
   	Inventory.PickupSound "misc/w_pkup"
	Tag "Morning Star"
	Weapon.Ammotype1 "Mana1"
	Weapon.AmmoUse1 3
	Weapon.Ammotype2 "Mana1"
	Weapon.AmmoUse2 3
	weapon.ammogive1 0
	Weapon.KickBack 100
	Weapon.SelectionOrder 3
	+WEAPON.AMMO_OPTIONAL
	+UNDROPPABLE
	+WEAPON.ALT_AMMO_OPTIONAL
	+MELEEWEAPON
	Weapon.BobStyle InverseSmooth
    Weapon.BobSpeed 2.1
    Weapon.BobRangeY 0.4
    Weapon.BobRangeX 0.7
	States
	{
	Spawn:
		MRNS A -1
		Stop
	Select:
		MSTS E 0 A_JumpIfInventory("Mana1", 3, "SelectMana")
		MSTS E 1 A_Raise
		TNT1 A 0 A_Raise
		Loop
	SelectMana:
		MNST E 1 A_Raise
		TNT1 A 0 A_Raise
		Loop
	DeSelect:
		MSTS E 0 A_JumpIfInventory("Mana1", 3, "DeSelectMana")
		MSTS E 1 A_Lower
		TNT1 A 0 A_Lower
		Loop
	DeSelectMana:
		MNST E 1 A_Lower
		TNT1 A 0 A_Lower
		Loop
	Ready:
		MSTS E 0 A_JumpIfInventory("Mana1", 3, "ReadyMana")
		MSTS E 1 A_WeaponReady
		Loop
	ReadyMana:
		MNST E 1 A_WeaponReady
		Loop
	Fire:
		TNT1 A 0 A_JumpIfInventory("PowerSacrificeIcon",1,"FireS")
	    TNT1 F 0 A_Jump(128,"Swing2")
		TNT1 F 0 A_JumpIfNoAmmo("NoManaHit")
		MNST F 1 offset(38,24)
		MNST F 1 offset(36,26)
		TNT1 A 0 A_PlayWeaponSound("ClericFlailMiss")
		MNST G 1 offset(34,28) 
		MNST G 1 offset(32,30)
		MNST H 1 offset(30,32)
		MNST H 1 offset(26,36)
		MNST I 1 offset(33,34)
		MNST I 1 offset(24,40)
		MNST I 1 offset(15,44) A_FireBullets(0,0,1,0,"FlailPuff",FBF_NORANDOM,168)
		MNST J 1 offset(26,32) 
		MNST J 1 offset(20,34) 
		MNST J 1 offset(15,37) 
		MNST K 3
		TNT1 A 5 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
	NoManaHit:
		MSTS F 1 offset(38,24)
		MSTS F 1 offset(36,26)
		TNT1 A 0 A_PlayWeaponSound("ClericFlailMiss")
		MSTS G 1 offset(34,28) 
		MSTS G 1 offset(32,30)
		MSTS H 1 offset(30,32)
		MSTS H 1 offset(26,36)
		MSTS I 1 offset(33,34)
		MSTS I 1 offset(24,40)
		MSTS I 1 offset(15,44) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(45,62), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"FlailPuff2",FBF_NORANDOM,144)
		MSTS J 1 offset(26,32) 
		MSTS J 1 offset(20,34) 
		MSTS J 1 offset(15,37) 
		MSTS K 3
		TNT1 A 5 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
	Swing2:
		TNT1 F 0 A_JumpIfNoAmmo("NoManaHit2")
		TNT1 A 3
		MNST A 0 A_PlayWeaponSound("ClericFlailMiss")
		MNST A 1 offset(0,32)
		MNST A 1 offset(8,32)
		MNST A 1 offset(16,32)
		MNST B 1 offset(24,32)
		MNST B 1 offset(32,32)
		MNST B 1 offset(38,32)
		MNST C 1 offset(32,32) A_FireBullets(0,0,1,0,"FlailPuff",FBF_NORANDOM,168)
		MNST C 2 offset(38,32)
		MNST D 4 offset(32,32)
		TNT1 A 4 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
	NoManaHit2:
		MSTS A 0 A_PlayWeaponSound("ClericFlailMiss")
		TNT1 A 3
		MSTS A 1 offset(0,32)
		MSTS A 1 offset(8,32)
		MSTS A 1 offset(16,32)
		MSTS B 1 offset(24,32)
		MSTS B 1 offset(32,32)
		MSTS B 1 offset(38,32)
		MSTS C 1 offset(32,32) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(45,62), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"FlailPuff2",FBF_NORANDOM,144)
		MSTS C 2 offset(38,32)
		MSTS D 4 offset(32,32)
		TNT1 A 4 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory("PowerSacrificeIcon",1,"AltFireS")
		TNT1 A 2
		CSHL A 0 A_JumpIfInventory("PowerInvulnerable",1,2)
		CSHL A 0 a_setreflectiveinvulnerable
		CSHL A 1 offset(120,90) a_changeflag("shieldreflect",1)
		CSHL A 1 offset(60,60)
		CSHL a 0 offset(-1,40) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(10,20), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"ShieldPuff",FBF_NORANDOM,96)
		CSHL a 1 offset(-1,40)
		CSHL a 1 offset(-60,45)
		CSHL a 1 offset(-120,50)
		CSHL a 0 a_changeflag("shieldreflect",0)
		CSHL a 0 A_JumpIfInventory("PowerInvulnerable",1,2)
		CSHL a 0 a_unsetreflectiveinvulnerable
		CSHL a 1 offset(-160,60)
		TNT1 a 9 a_weaponready(wrf_nobob|wrf_nosecondary|wrf_noswitch)
		TNT1 a 0 a_refire
		TNT1 A 0 A_JumpIfNoAmmo(5)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
		
	FireS:
	    TNT1 F 0 A_Jump(128,"Swing2S")
		TNT1 F 0 A_JumpIfNoAmmo("NoManaHitS")
		MNST F 1 offset(38,24)
		MNST F 1 offset(36,26)
		TNT1 A 0 A_PlayWeaponSound("ClericFlailMiss")
		MNST G 1 offset(34,28) 
		MNST G 1 offset(32,30)
		MNST H 1 offset(30,32)
		MNST H 1 offset(26,36)
		MNST I 1 offset(33,34)
		MNST I 1 offset(24,40)
	    MNST C 0 A_FireBullets(0,0,1,0,"SacrificePuffGhost",FBF_NORANDOM,168)
		MNST I 1 offset(15,44) A_FireBullets(0,0,1,0,"FlailPuff",FBF_NORANDOM,168)
		MNST J 1 offset(26,32) 
		MNST J 1 offset(20,34) 
		MNST J 1 offset(15,37) 
		MNST K 3
		TNT1 A 5 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
	NoManaHitS:
		MSTS F 1 offset(38,24)
		MSTS F 1 offset(36,26)
		TNT1 A 0 A_PlayWeaponSound("ClericFlailMiss")
		MSTS G 1 offset(34,28) 
		MSTS G 1 offset(32,30)
		MSTS H 1 offset(30,32)
		MSTS H 1 offset(26,36)
		MSTS I 1 offset(33,34)
		MSTS I 1 offset(24,40)
	    MSTS C 0 A_FireBullets(0,0,1,0,"SacrificePuff",FBF_NORANDOM,144)
		MSTS I 1 offset(15,44) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(45,62), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"FlailPuff2",FBF_NORANDOM,144)
		MSTS J 1 offset(26,32) 
		MSTS J 1 offset(20,34) 
		MSTS J 1 offset(15,37) 
		MSTS K 3
		TNT1 A 5 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
	Swing2S:
		TNT1 F 0 A_JumpIfNoAmmo("NoManaHit2S")
		TNT1 A 3
		MNST A 0 A_PlayWeaponSound("ClericFlailMiss")
		MNST A 1 offset(0,32)
		MNST A 1 offset(8,32)
		MNST A 1 offset(16,32)
		MNST B 1 offset(24,32)
		MNST B 1 offset(32,32)
		MNST B 1 offset(38,32)
	    MNST C 0 A_FireBullets(0,0,1,0,"SacrificePuffGhost",FBF_NORANDOM,168)
		MNST C 1 offset(32,32) A_FireBullets(0,0,1,0,"FlailPuff",FBF_NORANDOM,168)
		MNST C 2 offset(38,32)
		MNST D 4 offset(32,32)
		TNT1 A 4 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
	NoManaHit2S:
		MSTS A 0 A_PlayWeaponSound("ClericFlailMiss")
		TNT1 A 3
		MSTS A 1 offset(0,32)
		MSTS A 1 offset(8,32)
		MSTS A 1 offset(16,32)
		MSTS B 1 offset(24,32)
		MSTS B 1 offset(32,32)
		MSTS B 1 offset(38,32)
	    MSTS C 0 A_FireBullets(0,0,1,0,"SacrificePuff",FBF_NORANDOM,144)
		MSTS C 1 offset(32,32) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(45,62), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"FlailPuff2",FBF_NORANDOM,144)
		MSTS C 2 offset(38,32)
		MSTS D 4 offset(32,32)
		TNT1 A 4 a_weaponready(wrf_nobob|wrf_noprimary|wrf_noswitch)
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
	AltFireS:
		TNT1 A 2
		CSHL A 0 A_JumpIfInventory("PowerInvulnerable",1,2)
		CSHL A 0 a_setreflectiveinvulnerable
		CSHL A 1 offset(120,90) a_changeflag("shieldreflect",1)
		CSHL A 1 offset(60,60)
		CSHL A 0 A_FireBullets(0,0,1,0,"SacrificePuff",FBF_NORANDOM,96)
		CSHL a 0 offset(-1,40) A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(10,20), STRENGTH, ABIL_BLUNTMASTERY, ACTIVATOR),"ShieldPuff",FBF_NORANDOM,96)
		CSHL a 1 offset(-1,40)
		CSHL a 1 offset(-60,45)
		CSHL a 1 offset(-120,50)
		CSHL a 0 a_changeflag("shieldreflect",0)
		CSHL a 0 A_JumpIfInventory("PowerInvulnerable",1,2)
		CSHL a 0 a_unsetreflectiveinvulnerable
		CSHL a 1 offset(-160,60)
		TNT1 a 9 a_weaponready(wrf_nobob|wrf_nosecondary|wrf_noswitch)
		TNT1 a 0 a_refire
		TNT1 A 0 A_JumpIfNoAmmo(5)
		MNST E 1 offset(50,120) A_ReFire
		MNST E 1 offset(40,100)
		MNST E 1 offset(20,70)
		MNST E 1 offset(8,50)
		Goto Ready
		MSTS E 1 offset(50,120) A_ReFire
		MSTS E 1 offset(40,100)
		MSTS E 1 offset(20,70)
		MSTS E 1 offset(8,50)
		Goto Ready
	}
}

Actor FlailPuff
{
	+NOBLOCKMAP
	+NOGRAVITY
	+PUFFONACTORS
	+PUFFGETSOWNER
	+MTHRUSPECIES
	+FORCERADIUSDMG
	Radius 8
	Height 12
	Renderstyle Add
	Damagetype "Fire"
	SeeSound "ClericFlailHitThing"
	AttackSound "ClericFlailHitWall"
  //ActiveSound "FighterHammerMiss"

	States
	{
	Spawn:
	Melee:
		CFCF Q 0 Bright
		CFCF Q 0 Bright A_PlaySound("ClericFlailExplode", 5)
		CFCF Q 0 Bright A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(90,124), STRENGTH, ABIL_BLUNTMASTERY, WOCTARGET), 96, 0, 1, 9)
		CFCF Q 0 Bright A_TakeFromTarget("Mana1", 3, TIF_NOTAKEINFINITE)
		CFCF Q 1 Bright A_NoGravity
		CFCF Q 0 A_GiveToTarget("ScreenPitch2")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF Q 0 A_GiveToTarget("ScreenPitch1Back")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF Q 0 A_GiveToTarget("ScreenPitch1Back")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF R 0 Bright A_Scream
		CFCF RRR 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF SSSS 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF T 3 Bright
		CFCF U 4 Bright
		CFCF W 3 Bright
		CFCF X 4 Bright
		CFCF Z 3 Bright
		Stop
	Crash:
		FHFX S 0
		FHFX S 1 A_SetTranslucent(0.6,0)
		FHFX S 1 A_GiveToTarget("ScreenPitch2")
		FHFX SS 1 A_GiveToTarget("ScreenPitch1Back")
		FHFX TUVW 4
		Stop
	}
}

actor FlailPuffParticleFXSpawner
{
	+NoBlockMap +NoGravity +NoSector +NoInteraction +NoClip -Solid +CLIENTSIDEONLY
    states
	{
	Spawn:
	Active:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(Args[1], "Circle")
		TNT1 A 2
		TNT1 A 0 A_SpawnItemEx ("FlailPuffParticleFX", frandom(-1, 1), frandom(-2, 2), frandom(-2, 2), (0.1)*frandom(-3, 3), (0.5)*frandom(-3, 3), (0.4)*frandom(-3, 3), 0 , SXF_ABSOLUTEMOMENTUM, Args[2])
		TNT1 A 0 A_SpawnItemEx ("FlailPuffParticleFX", frandom(-1, 1), frandom(-2, 2), frandom(-2, 2), (0.1)*frandom(-3, 3), (0.5)*frandom(-3, 3), (0.4)*frandom(-3, 3), 0 , SXF_ABSOLUTEMOMENTUM, Args[2]) 
		Stop
	Circle:
		TNT1 A 0
		TNT1 A 2 A_SpawnItemEx ("FlailPuffParticleFX", frandom(-Args[0], Args[0]), 0, frandom(0, 8), (0.1)*frandom(1, 3), 0, (0.1)*frandom(1, 10), 0 , 129, Args[2]) 
		Loop
	Inactive:
		TNT1 A 1
		Loop
	}  
}

ACTOR FlailPuffParticleFX
{
	+Missile
	+NoBlockmap
	+NoInteraction
	-Solid
	+CLIENTSIDEONLY
	Radius 0
	Height 0
	RenderStyle Add
	Alpha 0.8
	Scale 0.7
	Gravity 0.25
	States
	{
	Spawn:
		CFCF QQRRSSTTUUVVWWXXZZ 1 Bright A_FadeOut(0.06)
		Stop
	}
}

Actor FlailPuff2
{
	+NOBLOCKMAP
	+NOGRAVITY
	+PUFFONACTORS
	+PUFFGETSOWNER
	+THRUGHOST
	+MTHRUSPECIES
	Radius 8
	Height 12
	Alpha 0.6
	Renderstyle Translucent
	SeeSound "ClericFlailHitThing"
	AttackSound "ClericFlailHitWall"
	Damagetype "Physical"

	States
	{
	Spawn:
		FHFX S 1
		FHFX S 1 A_GiveToTarget("ScreenPitch2")
		FHFX SS 1 A_GiveToTarget("ScreenPitch1Back")
		FHFX TUVW 4
		Stop
	}
}